<script setup>
import {ref} from 'vue'
import Bus from "@/utils/bus";
import {useRouter} from "vue-router";

const router = useRouter();
const loading = ref(false)
const tip = ref('请等待...')
Bus.on("loading", (data) => {
  if (typeof data === 'boolean') {
    tip.value = '请等待...'
    loading.value = data
  } else {
    tip.value = data.tip ? data.tip : '请等待...'
    loading.value = data.type
  }
});
Bus.on("login", (data) => {
  router.push('/login')
});
</script>

<template>
  <a-spin :loading="loading" dot :tip="tip">
    <router-view/>
  </a-spin>
</template>